package com.example.demo.service;

import javax.servlet.*;
import java.io.IOException;

/**
 * @ClassName LogFilter
 * @Author bsy
 * @Description TODO
 * @Date 2022/8/24 23:24
 * @Version 1.0
 */
public class LogFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("记录请求日志");
        chain.doFilter(request, response);
        System.out.println("记录响应日志");
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
